package com.fyzk.utils;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by miao on 2017/12/4.
 */

public class JCCodeTranslate {
    public final String LETVS_0 = "letvs_0";
    public final String LETVS_1 = "letvs_1";
    public final String LETVS_3 = "letvs_3";
    public final String VS_0 = "vs_0";
    public final String VS_1 = "vs_1";
    public final String VS_3 = "vs_3";
    public final String SCORE_0 = "score_0";
    public final String SCORE_1 = "score_1";
    public final String SCORE_2 = "score_2";
    public final String SCORE_3 = "score_3";
    public final String SCORE_4 = "score_4";
    public final String SCORE_5 = "score_5";
    public final String SCORE_6 = "score_6";
    public final String SCORE_7 = "score_7";
    public final String BQC_00 = "bqc_00";
    public final String BQC_01 = "bqc_01";
    public final String BQC_03 = "bqc_03";
    public final String BQC_10 = "bqc_10";
    public final String BQC_11 = "bqc_11";
    public final String BQC_13 = "bqc_13";
    public final String BQC_31 = "bqc_31";
    public final String BQC_30 = "bqc_30";
    public final String BQC_33 = "bqc_33";
    public final String BF_00 = "bf_00";
    public final String BF_01 = "bf_01";
    public final String BF_02 = "bf_02";
    public final String BF_03 = "bf_03";
    public final String BF_04 = "bf_04";
    public final String BF_05 = "bf_05";
    public final String BF_09 = "bf_09";
    public final String BF_10 = "bf_10";
    public final String BF_11 = "bf_11";
    public final String BF_12 = "bf_12";
    public final String BF_13 = "bf_13";
    public final String BF_14 = "bf_14";
    public final String BF_15 = "bf_15";
    public final String BF_20 = "bf_20";
    public final String BF_21 = "bf_21";
    public final String BF_22 = "bf_22";
    public final String BF_23 = "bf_23";
    public final String BF_24 = "bf_24";
    public final String BF_25 = "bf_25";
    public final String BF_30 = "bf_30";
    public final String BF_31 = "bf_31";
    public final String BF_32 = "bf_32";
    public final String BF_33 = "bf_33";
    public final String BF_40 = "bf_40";
    public final String BF_41 = "bf_41";
    public final String BF_42 = "bf_42";
    public final String BF_50 = "bf_50";
    public final String BF_51 = "bf_51";
    public final String BF_52 = "bf_52";
    public final String BF_90 = "bf_90";
    public final String BF_99 = "bf_99";

    List<String> bfs;
    List<String> bqcs;
    List<String> scores;
    List<String> vss;
    List<String> letvss;

    public static JCCodeTranslate instance = null;

    private Map<String, String> maps = new HashMap<>();


    public int getItemCode(String code) {
        if(vss.contains(code)){
            return  LotteryIDUtils.JZSPF_LOTTERY_ID_INT;
        }
        if(letvss.contains(code)){
            return  LotteryIDUtils.JZRFSPF_LOTTERY_ID_INT;
        }
        if(bqcs.contains(code)){
            return  LotteryIDUtils.JZBQC_LOTTERY_ID_INT;
        }
        if(scores.contains(code)){
            return  LotteryIDUtils.JZZJQ_LOTTERY_ID_INT;
        }
        return  LotteryIDUtils.JZBF_LOTTERY_ID_INT;
    }

    private JCCodeTranslate() {

        maps.put(LETVS_0, "让负");
        maps.put(LETVS_1, "让平");
        maps.put(LETVS_3, "让胜");
        maps.put(VS_0, "负");
        maps.put(VS_1, "平");
        maps.put(VS_3, "胜");
        maps.put(SCORE_0, "0球");
        maps.put(SCORE_1, "1球");
        maps.put(SCORE_2, "2球");
        maps.put(SCORE_3, "3球");
        maps.put(SCORE_4, "4球");
        maps.put(SCORE_5, "5球");
        maps.put(SCORE_6, "6球");
        maps.put(SCORE_7, "7+球");
        maps.put(BQC_00, "负负");
        maps.put(BQC_01, "负平");
        maps.put(BQC_03, "负胜");
        maps.put(BQC_10, "平负");
        maps.put(BQC_11, "平平");
        maps.put(BQC_13, "平胜");
        maps.put(BQC_31, "胜平");
        maps.put(BQC_30, "胜负");
        maps.put(BQC_33, "胜胜");
        maps.put(BF_00, "0:0");
        maps.put(BF_01, "0:1");
        maps.put(BF_02, "0:2");
        maps.put(BF_03, "0:3");
        maps.put(BF_04, "0:4");
        maps.put(BF_05, "0:5");
        maps.put(BF_09, "负其他");
        maps.put(BF_10, "1:0");
        maps.put(BF_11, "1:1");
        maps.put(BF_12, "1:2");
        maps.put(BF_13, "1:3");
        maps.put(BF_14, "1:4");
        maps.put(BF_15, "1:5");
        maps.put(BF_20, "2:0");
        maps.put(BF_21, "2:1");
        maps.put(BF_22, "2:2");
        maps.put(BF_23, "2:3");
        maps.put(BF_24, "2:4");
        maps.put(BF_25, "2:5");
        maps.put(BF_30, "3:0");
        maps.put(BF_31, "3:1");
        maps.put(BF_32, "3:2");
        maps.put(BF_33, "3:3");
        maps.put(BF_40, "4:0");
        maps.put(BF_41, "4:1");
        maps.put(BF_42, "4:2");
        maps.put(BF_50, "5:0");
        maps.put(BF_51, "5:1");
        maps.put(BF_52, "5:2");
        maps.put(BF_90, "胜其他");
        maps.put(BF_99, "平其他");

        bfs = new ArrayList<>();
        bfs.add(BF_00);
        bfs.add(BF_01);
        bfs.add(BF_02);
        bfs.add(BF_03);
        bfs.add(BF_04);
        bfs.add(BF_05);
        bfs.add(BF_09);
        bfs.add(BF_10);
        bfs.add(BF_11);
        bfs.add(BF_12);
        bfs.add(BF_13);
        bfs.add(BF_14);
        bfs.add(BF_15);
        bfs.add(BF_20);
        bfs.add(BF_21);
        bfs.add(BF_22);
        bfs.add(BF_23);
        bfs.add(BF_24);
        bfs.add(BF_25);
        bfs.add(BF_30);
        bfs.add(BF_31);
        bfs.add(BF_32);
        bfs.add(BF_33);
        bfs.add(BF_40);
        bfs.add(BF_41);
        bfs.add(BF_42);
        bfs.add(BF_50);
        bfs.add(BF_51);
        bfs.add(BF_52);
        bfs.add(BF_90);
        bfs.add(BF_99);

        vss = new ArrayList<>();
        vss.add(VS_0);
        vss.add(VS_1);
        vss.add(VS_3);

        letvss = new ArrayList<>();
        letvss.add(LETVS_0);
        letvss.add(LETVS_1);
        letvss.add(LETVS_3);

        scores = new ArrayList<>();
        scores.add(SCORE_0);
        scores.add(SCORE_1);
        scores.add(SCORE_2);
        scores.add(SCORE_3);
        scores.add(SCORE_4);
        scores.add(SCORE_5);
        scores.add(SCORE_6);
        scores.add(SCORE_7);


        bqcs = new ArrayList<>();
        bqcs.add(BQC_00);
        bqcs.add(BQC_01);
        bqcs.add(BQC_03);
        bqcs.add(BQC_10);
        bqcs.add(BQC_11);
        bqcs.add(BQC_13);
        bqcs.add(BQC_31);
        bqcs.add(BQC_30);
        bqcs.add(BQC_33);


    }

    public static JCCodeTranslate getInstance() {
        if (instance == null) {
            instance = new JCCodeTranslate();
        }
        return instance;
    }

    public String getCodeTranslate(String key) {
        return maps.get(key);
    }

}
